Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Remove congestion multiplier from calculate fee #34865

Conversation

tao-stones
Copy link
Contributor

Problem

congestion_multiplier variable in sdk::fee_structure::calculate_fee(...) does not have to do with congestion, it actually zeros out transaction fee for tests that don't handle transaction fees - those tests sets fee rate to zero in genesis config.

It is better to sync up fee_structure with fee_rate_governor during bank initialization to support those tests.

Summary of Changes

  • set fee_structure.lamports_per_signature by fee_rate_governor during bank initialization
  • remove congestion_multiplier in calculation_fee()

Fixes #

@tao-stones
Copy link
Contributor Author

as Draft until rebaseed after #34821 is merged

Copy link

codecov bot commented Jan 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a5c470d) 81.7% compared to head (d8fff7f) 81.7%.
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #34865     +/-   ##
=========================================
- Coverage    81.7%    81.7%   -0.1%     
=========================================
  Files         826      826             
  Lines      223413   223411      -2     
=========================================
- Hits       182614   182573     -41     
- Misses      40799    40838     +39     

@tao-stones tao-stones force-pushed the remove-congestion-multiplier-from-calculate-fee branch from 4920552 to 49adf4f Compare January 22, 2024 19:52
remove congestion_multiplier from calculacte_fee(), leave parameters unused for now.
@tao-stones tao-stones force-pushed the remove-congestion-multiplier-from-calculate-fee branch from 49adf4f to d8fff7f Compare January 22, 2024 19:55
@tao-stones tao-stones marked this pull request as ready for review January 22, 2024 22:17
@mergify mergify bot added community Community contribution need:merge-assist labels Jan 23, 2024
// new bank's fee_structure.lamports_per_signature should be inline with
// what's configured in GenesisConfig
self.fee_structure.lamports_per_signature =
derived_fee_rate_governor.lamports_per_signature;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently behavior:

  1. genesis_config either have fee_rate_gonervor set to 0 (or any other value) lamports_per_signature for test or 5_000 in production;
  2. fee_structure is always default to 5_000 lamports_per_signature regardless.

This change is to initialize fee_structure to have same lamports_per_signature as in fee_rate_governor.

@@ -80,17 +80,10 @@ impl FeeStructure {
pub fn calculate_fee(
&self,
message: &SanitizedMessage,
lamports_per_signature: u64,
_lamports_per_signature: u64,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove this parameter in separate PR involving removing fetching nonce lamports_per_signature.

Copy link
Contributor

@apfitzge apfitzge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tao-stones tao-stones merged commit 73d3973 into solana-labs:master Jan 23, 2024
47 checks passed
@tao-stones tao-stones deleted the remove-congestion-multiplier-from-calculate-fee branch January 23, 2024 19:00
tao-stones added a commit to tao-stones/solana that referenced this pull request Jan 30, 2024
tao-stones added a commit to tao-stones/solana that referenced this pull request Jan 30, 2024
tao-stones added a commit that referenced this pull request Jan 30, 2024
mergify bot pushed a commit that referenced this pull request Jan 30, 2024
This reverts commit 73d3973.

(cherry picked from commit 0dcac3f)

# Conflicts:
#	sdk/src/fee.rs
tao-stones added a commit that referenced this pull request Jan 31, 2024
* Revert "refactor unused parameter (#34970)"

This reverts commit 0838909.

(cherry picked from commit 1542392)

# Conflicts:
#	sdk/src/fee.rs

* Revert "separate priority fee and transaction fee from fee calculation (#34757)"

This reverts commit 5ecc47e.

(cherry picked from commit df2ee12)

# Conflicts:
#	sdk/src/fee.rs

* Revert "Remove congestion multiplier from calculate fee (#34865)"

This reverts commit 73d3973.

(cherry picked from commit 0dcac3f)

# Conflicts:
#	sdk/src/fee.rs

* fix merge conflicts

---------

Co-authored-by: Tao Zhu <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community Community contribution need:merge-assist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants